package com.example.suanfa;

import java.util.Arrays;
import java.util.Random;

public class DataChecker {
    public static void main(String[] args) {
        check();
    }

    static int[] generateRandomArray() {
        Random random = new Random();
        int[] arr = new int[10000];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = random.nextInt(10000);
        }
        return arr;
    }

    static void check() {
        int[] arr = generateRandomArray();
        int[] result = new int[arr.length];
        System.arraycopy(arr, 0, result, 0, result.length);
        Arrays.sort(arr);
//        SelectionSort.sort(result);
//        BubbleSort.sort(result);
        InsertionSort.sort(result);
//        QuickSort.sort(result, 0, result.length - 1);
//        print(result);
//        MergeSort.sort(result, 0, arr.length - 1);
        boolean same = true;
        for (int i = 0; i < result.length; i++) {
            if (arr[i] != result[i]) {
                System.out.println(arr[i] + "--->" + result[i]);
                same = false;
            }
        }
        System.out.println(same == true ? "right" : "wrong");
    }

    static void print(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }


}
